package com.shaoshaohuo.app.ui.ec;

import com.shaoshaohuo.app.R;
import com.shaoshaohuo.app.framework.AccountManager;
import com.shaoshaohuo.app.ui.BaseActivity;
import com.shaoshaohuo.app.view.TopbarView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * @author: yusonglin
 * @类 说 明:
 * @version 1.0
 * @创建时间：2015年8月31日 下午12:45:47
 * 
 */
public class MyEcInfoActivity extends BaseActivity implements OnClickListener {

    private TopbarView mTopbarView;

    private View mWantBuyLayout;
    private View mWantSellLayout;
    private View mReleaseInfoLayout;
    private View mSellRecordLayout;
    private View mBuyRecordLayout;
    private View mBusinessRecordLayout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_ec_info);
        initView();
        setUpView();
    }

    private void initView() {
        mTopbarView = (TopbarView) this.findViewById(R.id.topbar);

        mWantBuyLayout = this.findViewById(R.id.layout_iwant_buy);
        mWantSellLayout = this.findViewById(R.id.layout_iwant_sell);
        mReleaseInfoLayout = this.findViewById(R.id.layout_fabushangji);
        mSellRecordLayout = this.findViewById(R.id.layout_gonghuojilu);
        mBuyRecordLayout = this.findViewById(R.id.layout_caigoujilu);
        mBusinessRecordLayout = this.findViewById(R.id.layout_business_history);
    }

    private void setUpView() {
        mTopbarView.setCenterText("我的信息");
        mTopbarView.setLeftView(true, true);

        mWantBuyLayout.setOnClickListener(this);
        mWantSellLayout.setOnClickListener(this);
        mReleaseInfoLayout.setOnClickListener(this);
        mSellRecordLayout.setOnClickListener(this);
        mBuyRecordLayout.setOnClickListener(this);
        mBusinessRecordLayout.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
        case R.id.layout_iwant_buy:
            if (AccountManager.checkUserAuth(this)) {
                startActivity(new Intent(this, BuysGoodsActivity.class));
            }
            break;
        case R.id.layout_iwant_sell:
            if (AccountManager.checkUserAuth(this)) {
                startActivity(new Intent(this, SellsGoodsActivity.class));
            }
            break;
        case R.id.layout_fabushangji:
            if (AccountManager.checkUserAuth(this)) {
                startActivity(new Intent(this, ReleaseOpportunityActivity.class));
            }
            break;
        case R.id.layout_gonghuojilu:
            startActivity(new Intent(this, SupplyRecordActivity.class));
            break;
        case R.id.layout_caigoujilu:
            startActivity(new Intent(this, PurchaseRecordActivity.class));
            break;
        case R.id.layout_business_history:
            startActivity(new Intent(this, BusinessRecordActivity.class));
            break;
        }
    }

}
